<!DOCTYPE HTML>
<html>
    <meta charset="UTF-8" />
    <title>Goyello RESTful Test | Patryk Jar</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/logic.js"></script>
    <script type="text/javascript" src="js/view.js"></script>
    <style type="text/css">
        li
        {
            cursor: pointer;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function()
        {
            var view = goyello.view()
            ,   RESOURCE = 'addresses'
            ,   app = goyello.logic(view, RESOURCE);

            $('#bClear').click(view.clearForm);
            $('#bGetAll').click(app.getAll);
            $('#bAdd').click(app.add);
            $('#bUpdate').click(app.update);
            $('#bDelete').click(app.del);
            $('#bDeleteAll').click(app.deleteAll);
        });
    </script>
<body>

<form action="#" onsubmit="return false">
    <table>
        <tr style="display: none">
            <td><label for="ADDRESSID">id: </label></td>
            <td><input type="text" id="ADDRESSID" /></td>
        </tr>
        <tr>
            <td><label for="LABEL">Etykieta: </label></td>
            <td><input type="text" id="LABEL" /></td>
        </tr>
        <tr>
            <td><label for="STREET">Ulica: </label></td>
            <td><input type="text" id="STREET" /></td>
        </tr>
        <tr>
            <td><label for="HOUSENUMBER">Nr. domu: </label></td>
            <td><input type="text" id="HOUSENUMBER" /></td>
        </tr>
        <tr>
            <td><label for="POSTALCODE">Kod pocztowy: </label></td>
            <td><input type="text" id="POSTALCODE" /></td>
        </tr>
        <tr>
            <td><label for="COUNTRY">Kraj: </label></td>
            <td><input type="text" id="COUNTRY" /></td>
        </tr>
        <tr>
            <td><label for="CITY">Miasto: </label></td>
            <td><input type="text" id="CITY" /></td>
        </tr>
    </table>
</form>

<button id="bClear">Wyczyść formularz</button>
<button id="bGetAll">Odczytaj wszystkie</button>
<button id="bAdd">Dodaj</button>
<button id="bUpdate">Zmień</button>
<button id="bDelete">Usuń wyświetlany</button>
<button id="bDeleteAll">Usuń wszystkie</button>


<ul id="result"></ul>

</body>
</html>
